<template>
  <div>
    <p>你要购买的商品:{{count}}</p>
    <button @click="addFn">加1</button>
    <button @click="addCountFn(5)">加5</button>
    <button @click="subFn">减1</button>
  </div>
</template>

<script>
export default {
  name: 'Homework2App',

  data() {
    return {
      count:0
    };
  },

  mounted() {
    
  },

  methods: {
    addFn (){
      this.count++  
    },
    addCountFn(num){
      this.count+=num
    },
    subFn(){
      this.count--
    }
  },
};
</script>

<style lang="scss" scoped>

</style>